layui.config({
	base: 'lib/js/'
}).use(['form','jquery','common'], function () {
	var $ = layui.$;
	var form = layui.form,
		commom = layui.common,
		layer = layui.layer;
	form.on('submit(loginbtn)', function(data){
		$.ajax({
			type: 'POST',
			url: commom.contextUrl + 'login',
			data: data.field,
			success: function (res) {
				if(res.success){
					layui.data('token', {
						key: 'token',value: res.data
					});
					location.href='src/main.html';
				}
			}
		});
		return false;
	  });
});